<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>operateSign.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  </head>
  
  <body>
	<script type="text/javascript">
		/* JavaScript && operate,依次获取每一个操作数,将他们转化为布尔型,如果是 false,刚直接返回这个操作数的值 
		*/
		function test(){
			var a = "1"&&true&&0&&false&&"abc";
			alert(a);							//  a is 0
			var b = "abc"&&true&&"123";			
			alert(b);							//  b is 123
			var c = false;
			var d = !c;
			alert(d);							//  位非 : true
		}
	</script>
	<input type="button" onClick="test();" value="测试短路运算符" >
	<input type="button" onClick="testMonth();" value="判断月份的天数" >
	<script type="text/javascript">
			function testMonth(){	
				var month = prompt("请输入月份","1");
				month = parseInt(month);			// 将月份转换为数字类型
				switch(month){
					case 1:
					case 3:
					case 5:
					case 7:
					case 8:
					case 10:
					case 12:
						alert(month+"月有31天");
						break;
					case 4:
					case 6:
					case 9:
					case 11:
						alert(month+"月有30天");
						break;
					case 2:
						alert(month+"月有28天");
						break;
					default:
						alert("error");
						break;
				}
			}
	</script>
  </body>
</html>
